home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pine / imap-3.0 / ANSI / c-client / nntpcdos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-07  |  6.5 KB  |  143 lines

  1. /*
  2.  * Program:    Network News Transfer Protocol (NNTP) client routines for DOS
  3.  *
  4.  * Author:    Mark Crispin
  5.  *        Networks and Distributed Computing
  6.  *        Computing & Communications
  7.  *        University of Washington
  8.  *        Administration Building, AG-44
  9.  *        Seattle, WA  98195
  10.  *        Internet: MRC@CAC.Washington.EDU
  11.  *
  12.  * Date:    25 January 1993
  13.  * Last Edited:    7 June 1993
  14.  *
  15.  * Copyright 1993 by the University of Washington.
  16.  *
  17.  *  Permission to use, copy, modify, and distribute this software and its
  18.  * documentation for any purpose and without fee is hereby granted, provided
  19.  * that the above copyright notices appear in all copies and that both the
  20.  * above copyright notices and this permission notice appear in supporting
  21.  * documentation, and that the name of the University of Washington not be
  22.  * used in advertising or publicity pertaining to distribution of the software
  23.  * without specific, written prior permission.  This software is made
  24.  * available "as is", and
  25.  * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
  26.  * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
  27.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
  28.  * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
  29.  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
  30.  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
  31.  * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN
  32.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  33.  *
  34.  */
  35.  
  36. /* Build parameters */
  37.  
  38. #define NEWSRC(t) sprintf (t,"%s\\NEWSRC",myhomedir ())
  39. #define NEWNEWSRC(t) sprintf (t,"%s\\NEWSRC.NEW",myhomedir ())
  40. #define OLDNEWSRC(t) sprintf (t,"%s\\NEWSRC.OLD",myhomedir ())
  41.  
  42. /* Constants */
  43.  
  44. #define NNTPGOK (long) 211    /* NNTP group selection OK */
  45. #define NNTPGLIST (long) 215    /* NNTP group list being returned */
  46. #define NNTPHEAD (long) 221    /* NNTP header text */
  47. #define NNTPBODY (long) 222    /* NNTP body text */
  48.  
  49.  
  50. /* Command bits from nntp_getflags() */
  51.  
  52. #define fSEEN 1
  53. #define fDELETED 2
  54. #define fFLAGGED 4
  55. #define fANSWERED 8
  56.  
  57.  
  58. /* NNTP I/O stream local data */
  59.     
  60. typedef struct nntp_local {
  61.   SMTPSTREAM *nntpstream;    /* NNTP stream for I/O */
  62.   unsigned int dirty : 1;    /* disk copy of .newsrc needs updating */
  63.   int fd;            /* temporary file */
  64.   char *host;            /* local host name */
  65.   char *name;            /* local bboard name */
  66.   unsigned long *number;    /* news message numbers */
  67.   char *seen;            /* local seen status */
  68. } NNTPLOCAL;
  69.  
  70.  
  71. /* Convenient access to local data */
  72.  
  73. #define LOCAL ((NNTPLOCAL *) stream->local)
  74.  
  75. /* Function prototypes */
  76.  
  77. DRIVER *nntp_valid (char *name);
  78. void *nntp_parameters (long function,void *value);
  79. void nntp_find (MAILSTREAM *stream,char *pat);
  80. void nntp_find_bboards (MAILSTREAM *stream,char *pat);
  81. void nntp_find_all (MAILSTREAM *stream,char *pat);
  82. void nntp_find_all_bboards (MAILSTREAM *stream,char *pat);
  83. long nntp_subscribe (MAILSTREAM *stream,char *mailbox);
  84. long nntp_unsubscribe (MAILSTREAM *stream,char *mailbox);
  85. long nntp_subscribe_bboard (MAILSTREAM *stream,char *mailbox);
  86. long nntp_unsubscribe_bboard (MAILSTREAM *stream,char *mailbox);
  87. long nntp_create (MAILSTREAM *stream,char *mailbox);
  88. long nntp_delete (MAILSTREAM *stream,char *mailbox);
  89. long nntp_rename (MAILSTREAM *stream,char *old,char *new);
  90. MAILSTREAM *nntp_mopen (MAILSTREAM *stream);
  91. void nntp_close (MAILSTREAM *stream);
  92. void nntp_fetchfast (MAILSTREAM *stream,char *sequence);
  93. void nntp_fetchflags (MAILSTREAM *stream,char *sequence);
  94. ENVELOPE *nntp_fetchstructure (MAILSTREAM *stream,long msgno,BODY **body);
  95. char *nntp_fetchheader (MAILSTREAM *stream,long msgno);
  96. char *nntp_fetchtext (MAILSTREAM *stream,long msgno);
  97. char *nntp_fetchbody (MAILSTREAM *stream,long m,char *s,unsigned long *len);
  98. void nntp_slurp (MAILSTREAM *stream,unsigned long *siz);
  99. long nntp_read (MAILSTREAM *stream,unsigned long count,char *buffer);
  100. void nntp_setflag (MAILSTREAM *stream,char *sequence,char *flag);
  101. void nntp_clearflag (MAILSTREAM *stream,char *sequence,char *flag);
  102. void nntp_search (MAILSTREAM *stream,char *criteria);
  103. long nntp_ping (MAILSTREAM *stream);
  104. void nntp_check (MAILSTREAM *stream);
  105. void nntp_expunge (MAILSTREAM *stream);
  106. long nntp_copy (MAILSTREAM *stream,char *sequence,char *mailbox);
  107. long nntp_move (MAILSTREAM *stream,char *sequence,char *mailbox);
  108. long nntp_append (MAILSTREAM *stream,char *mailbox,STRING *message);
  109. void nntp_gc (MAILSTREAM *stream,long gcflags);
  110.  
  111. char *nntp_read_sdb (FILE **f);
  112. long nntp_update_sdb (char *name,char *data);
  113. short nntp_getflags (MAILSTREAM *stream,char *flag);
  114. char nntp_search_all (MAILSTREAM *stream,long msgno,char *d,long n);
  115. char nntp_search_answered (MAILSTREAM *stream,long msgno,char *d,long n);
  116. char nntp_search_deleted (MAILSTREAM *stream,long msgno,char *d,long n);
  117. char nntp_search_flagged (MAILSTREAM *stream,long msgno,char *d,long n);
  118. char nntp_search_keyword (MAILSTREAM *stream,long msgno,char *d,long n);
  119. char nntp_search_new (MAILSTREAM *stream,long msgno,char *d,long n);
  120. char nntp_search_old (MAILSTREAM *stream,long msgno,char *d,long n);
  121. char nntp_search_recent (MAILSTREAM *stream,long msgno,char *d,long n);
  122. char nntp_search_seen (MAILSTREAM *stream,long msgno,char *d,long n);
  123. char nntp_search_unanswered (MAILSTREAM *stream,long msgno,char *d,long n);
  124. char nntp_search_undeleted (MAILSTREAM *stream,long msgno,char *d,long n);
  125. char nntp_search_unflagged (MAILSTREAM *stream,long msgno,char *d,long n);
  126. char nntp_search_unkeyword (MAILSTREAM *stream,long msgno,char *d,long n);
  127. char nntp_search_unseen (MAILSTREAM *stream,long msgno,char *d,long n);
  128. char nntp_search_before (MAILSTREAM *stream,long msgno,char *d,long n);
  129. char nntp_search_on (MAILSTREAM *stream,long msgno,char *d,long n);
  130. char nntp_search_since (MAILSTREAM *stream,long msgno,char *d,long n);
  131. unsigned long nntp_msgdate (MAILSTREAM *stream,long msgno);
  132. char nntp_search_body (MAILSTREAM *stream,long msgno,char *d,long n);
  133. char nntp_search_subject (MAILSTREAM *stream,long msgno,char *d,long n);
  134. char nntp_search_text (MAILSTREAM *stream,long msgno,char *d,long n);
  135. char nntp_search_bcc (MAILSTREAM *stream,long msgno,char *d,long n);
  136. char nntp_search_cc (MAILSTREAM *stream,long msgno,char *d,long n);
  137. char nntp_search_from (MAILSTREAM *stream,long msgno,char *d,long n);
  138. char nntp_search_to (MAILSTREAM *stream,long msgno,char *d,long n);
  139. typedef char (*search_t) (MAILSTREAM *stream,long msgno,char *d,long n);
  140. search_t nntp_search_date (search_t f,long *n);
  141. search_t nntp_search_flag (search_t f,char **d);
  142. search_t nntp_search_string (search_t f,char **d,long *n);
  143.